package com.item.common;

import com.alibaba.fastjson.JSONObject;
import com.item.result.ResultVo;
import com.item.util.ResultVoUtil;
import lombok.Data;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;

/**
 * 传入xss不允许的参数  测试xssfilter
 * @author zhang-rongyao
 * @version V1.0
 * @Package com.item.common
 * @date 2021/8/6 14:12
 */
@Controller
@RequestMapping("/test")
public class TestController {

    @PostMapping("/a")
    @ResponseBody
    public ResultVo testss(Aaa a){

        System.out.println("a业务处理中......"+a);

        return ResultVoUtil.success("a业务处理完成",a);
    }

    @PostMapping("/b")
    @ResponseBody
    public ResultVo testb(@RequestBody JSONObject a){

        System.out.println("b业务处理中......"+a);

        return ResultVoUtil.success("b业务处理完成",a);
    }

    @PostMapping(value = "/upload")
    public Object upload(MultipartFile file){
        System.out.println(file.getOriginalFilename());
        return "OK";
    }


    @Data
    class Aaa{

        private String username;
        private String password;
    }
}
